package Util;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;

import java.io.File;

/**
 * Created with IntelliJ IDEA.
 * User: Lazarenok
 * Date: 19.11.13
 * Time: 21:02
 * To change this template use File | Settings | File Templates.
 */
public class WebDriverFactory {

private static WebDriver driver;


    public static WebDriver createDriver(String browserName){

        if (browserName.equals("firefox")){

            driver= new FirefoxDriver();

        } else if (browserName.equals("chrome")){

            File file = new File("src\\main\\resources\\chromedriver.exe");

            System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());

            driver = new ChromeDriver();

        }

        return driver;
    }
}